package org.rxc.gift.clients.fallback;

import feign.hystrix.FallbackFactory;
import org.rxc.gift.clients.AuthClient;
import org.rxc.gift.domain.LoginUser;
import org.rxc.gift.util.AjaxResult;
import org.springframework.stereotype.Component;

@Component
public class AuthClientFallback implements FallbackFactory<AuthClient> {
    @Override
    public AuthClient create(Throwable throwable) {
        return new AuthClient() {
            @Override
            public AjaxResult addOrUpdate(LoginUser loginUser) {
                return AjaxResult.me().setSuccess(false).setMessage("网络异常,请刷新重试");
            }
        };
    }
}
